import request from "@/utils/request";

// 列出所有配置文件类型
export function listConfigFileTypes() {
  return request({
    url: "/config_file/list_types/",
    method: "get",
  });
}

// 上传配置文件
export function uploadConfigFile(data) {
  return request({
    url: "/config_file/upload/",
    method: "post",
    data: data,
  });
}

// 获取配置文件
export function getConfigFile(fileId) {
  return request({
    url: "/config_file/read_one/",
    method: "get",
    params: {
      file_id: fileId,
    },
  });
}

// 提交数据中台接口配置
export function uploadDataApiSpecs(file) {
  const formData = new FormData();
  formData.append("file", file);
  return request({
    url: "/data_api/upload",
    method: "post",
    data: formData,
    headers: {
      "Content-Type": "multipart/form-data",
    },
  });
}
